<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <title>include - TagLib - Prails API Documentation</title>
    </head>
    <body>
        <h3 class="P4"><a name="_include"><span/></a>include</h3><h4 class="Heading_20_4"><a name="_Description_"><span/></a>Description:</h4>
        <p class="Text_20_body">
            Includes and evaluates either a template file or an event. When a template is included, it inherits the current variable scope/context of the line the include appears in. If an event is included, the current variable scope will be handed over to the handler as first parameter.
        </p>
        <h4 class="Heading_20_4"><a name="_Syntax_"><span/></a>Syntax:</h4>
        <p class="Text_20_body">
            <code><c:include (file="{template path}" | event="{event name}") /></code>
        </p>
        <table border="0" cellspacing="0" cellpadding="0" class="Table12">
            <colgroup>
                <col width="143"/><col width="599"/>
            </colgroup>
            <tr>
                <td style="text-align:left;width:3.283cm; " class="Table12_A1">
                    <p class="Table_20_Contents">
                        {event path}
                    </p>
                </td>
                <td style="text-align:left;width:13.716cm; " class="Table12_B1">
                    <p class="Table_20_Contents">
                        Path's event (event name in slash notation) to identify the template to be included.
                    </p>
                </td>
            </tr>
            <tr>
                <td style="text-align:left;width:3.283cm; " class="Table12_A2">
                    <p class="Table_20_Contents">
                        {event name}
                    </p>
                </td>
                <td style="text-align:left;width:13.716cm; " class="Table12_B2">
                    <p class="Table_20_Contents">
                        Full event name (in the colon notation) of the event to be included. Notice that the included event must not die or exit, but normally return it's content. The included event won't be decorated with the base template. 
                    </p>
                </td>
            </tr>
        </table>
        <h4 class="Heading_20_4"><a name="_Example_"><span/></a>Example:</h4>
        <p class="Text_20_body">
            This example loops over all elements of the <code>$arr_param["stories"]</code>
            and for each entry it includes the template from event <code>story:show</code>. Within that template the variable <code>$arr_param["story"]</code>(or <code>#story.</code>) can be used to access the current item.
        </p>
        <pre>
            <h1>Stories:</h1>
            <c:foreach var="stories" name="story">
                <c:include file="story/show" />
            </c:foreach>
        </pre>
        <p class="Text_20_body">
            whereas the <code>story:show</code> template would look like:
        </p>
        <pre>
            <div id="story#story.story_id">
                <h3>#story.title</h3>
                <p><?=wordcut($arr_param["story"]["content"], 200, "... read more")?></p>
            </div>
        </pre>
    </body>
</html>
